// This file is a part of jsnames project licensed under GPLv2
// Dominik Cebula
// http://code.google.com/p/jsnames/
var jsnames = {
	init: function(id) {
		if (typeof(jsnamesdb)=='undefined')
			alert('jsnamesdb not found, try using script html tag to include database');
		
		var el=document.getElementById(id);
		if (el==null)
			alert('datalist with id=['+id+'] not found');
		if (!(el instanceof HTMLDataListElement))
			alert('object with id=['+id+'] does not match HTMLDataListElement type');
		
		var html='';
		for (var i=0;i<jsnamesdb.length;i++)
			html+='<option value="'+jsnamesdb[i]+'" label="'+jsnamesdb[i]+'"></option>';
		el.innerHTML+=html;
	}
};